<?php

// generate some random data:
include "/config/koneksi.php";

$data_sudah_dijawab = array();
for($i=0; $i<12;$i++) {
	$q=mysql_query("SELECT count(*) as jumlah FROM konsultasi WHERE MONTH(tgl_konsultasi) = ".($i+1)." AND YEAR(tgl_konsultasi) = 2013 AND status_konsultasi='SUDAH DIJAWAB'");
	$no=0;
	$jumlah = 0;
	$r=mysql_fetch_array($q);
	$jumlah = $r['jumlah'];
	$data_sudah_dijawab[] = $jumlah;
}

$data_belum_dijawab = array();
for($i=0; $i<12;$i++) {
	$q=mysql_query("SELECT count(*) as jumlah FROM konsultasi WHERE MONTH(tgl_konsultasi) = ".($i+1)." AND YEAR(tgl_konsultasi) = 2013 AND status_konsultasi='BELUM DIJAWAB'");
	$no=0;
	$jumlah = 0;
	$r=mysql_fetch_array($q);
	$jumlah = $r['jumlah'];
	$data_belum_dijawab[] = $jumlah;
}

// use the chart class to build the chart:
include_once( '/ofc-library/open-flash-chart.php' );
$g = new graph();

// Spoon sales, March 2007
//$g->title( 'Laporan Pemasukan '. date("Y"), '{font-size: 26px;}' );
//$g->title( 'Laporan Pemasukan '. 2012, '{font-size: 26px;}' );
$g->title( ' ', '{font-size: 26px;}' );

//$g->set_data( $data );
$g->set_data( $data_sudah_dijawab );
$g->set_data( $data_belum_dijawab );
// label each point with its value
$g->set_x_labels( array('Jan','Feb','Mar','April','Mei','Juni','Juli','Agustus','Sept','Okt','Nov','Des' ) );

// set the Y max
$g->set_y_max( 20 );
// label every 20 (0,20,40,60)
$g->y_label_steps( 20 );

//$g->bar(70, '#ffccff');
$g->bar( 70, '0x9933CC', 'Sudah Dijawab', 10 );
$g->bar( 70, '0xCC3399', 'Belum Dijawab', 10); 

// we add 3 sets of data:
//$g->set_data( $data_1 );
// display the data
echo $g->render();
//echo $g2->render();

//$title = new title( date("D M d Y") );


?>
